import Vue from 'vue'
import VueRouter from 'vue-router'
import routes from './routes'
// import { getToken } from '@/utils/storage'

Vue.use(VueRouter)

const router = new VueRouter({
  routes
})

export default router

// const whiteList = ['/login', '/register']

// router.beforeEach((to, from, next) => {
//   const token = getToken()
//   // 判断有没有token
//   if (token) {
//     next()
//   } else if (whiteList.includes(to.path)) {
//     next()
//   } else {
//     next('/login')
//   }
// })
